@extends('Admin.Layouts.index')

@section('title_name')
    修改文章
@endsection

@section('style2')
    active
@endsection

@section('container')
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    <div class="container">
        <div class="mws-panel grid_8">
            <div class="mws-panel-header">
                <span>修改文章</span>
            </div>
            <div class="mws-panel-body no-padding">
                @if(count($errors)>0)
                    <div class="mws-form-message error">
                        <ul>
                            @foreach($errors->all() as $error)
                                <li>{{$error}}</li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                <form class="mws-form" action="/admin/articles/update" enctype="multipart/form-data" method="post">
                    {{csrf_field()}}
                    <div class="mws-form-inline">
                        <div class="mws-form-row">
                            <label class="mws-form-label">文章标题</label>
                            <div class="mws-form-item">
                                <input type="text" class="large" name="title" value="{{$data['title']}}">
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">所属分类</label>
                            <div class="mws-form-item">
                                <select class="large" name="cate_id">
                                    <option value="{{$data['cate_id']}}">{{$res[0]['name']}}</option>
                                    @foreach($cates as $k=>$v)
                                        <option value="{{$v['id']}}">{{$v['name']}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">文章配图</label>
                            <div class="mws-form-item">
                                <input type="hidden" name="id" value="{{$data['id']}}">
                                <input type="file" name="picture" value="" id="" class="large"  name="picture">
                                <img src="/Fileupload/{{$data['picture']}}" alt="" style="width: 50px;height: 50px;margin: 5px;">
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">文章简介</label>
                            <div class="mws-form-item">
                                <textarea rows="" cols="" class="large" name="descr">{{$data['descr']}}</textarea>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">文章详情</label>
                            <div class="mws-form-item">
                                <script id="editor" type="text/plain" style="width:1322px;height:300px;" name="content">{!!$data['content']!!}</script>
                                </div>
                                </div>
                                </div>
                                <div class="mws-button-row">
                                    <input type="submit" value="修改" class="btn btn-danger">
                                    <input type="reset" value="重置" class="btn ">
                                    </div>
                                    </form>
                                    </div>
                                    </div>
                                    </div>
                                    <script>
                                var ue = UE.getEditor('editor');
                                </script>
@endsection
